<?php
require("include/common.php");
$q=$db->getlist("show full fields from info ");
/*ALTER TABLE  `info` ADD  `test` VARCHAR( 10 ) NOT NULL DEFAULT  '3' COMMENT  '000'*/
if($dosubmit){
	if(!$field1) msg("no field");
	if(!$type1)	msg("no type");
	$type3=$type2?"$type1($type2)":$type1;
	$sql="ALTER TABLE  `info` ADD  `$field1` $type3 ";
	$sql.=$null1?" NULL ":" NOT NULL ";
	$sql.=$default1?" DEFAULT '$default1' ":"";
	$sql.=$comment1?" COMMENT '$comment1' ":"";
	$db->query($sql);
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Info Fields Manage</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #000000;
}
body {
	background-color: #FFFFFF;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>

<body>
<form action="" method="post">
<table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td align="right" bgcolor="#f1f1f1">字段</td>
    <td align="left"><input name="field1" type="text" id="field1" size="20" maxlength="20" /></td>
  </tr>
  <tr>
    <td align="right" bgcolor="#f1f1f1">类型</td>
    <td align="left"><input name="type1" type="text" id="type1" size="10" maxlength="20" />
      <input name="type2" type="text" id="type2" size="10" maxlength="10" /></td>
  </tr>
  <tr>
    <td align="right" bgcolor="#f1f1f1">允许空</td>
    <td align="left"><input name="null1" type="checkbox" id="null1" value="1" /></td>
  </tr>
  <tr>
    <td align="right" bgcolor="#f1f1f1">注释</td>
    <td align="left"><input name="comment1" type="text" id="comment1" size="20" maxlength="20" /></td>
  </tr>
  <tr>
    <td align="right" bgcolor="#f1f1f1">默认</td>
    <td align="left"><input name="default1" type="text" id="default1" size="20" maxlength="20" /></td>
  </tr>
  <tr>
    <td align="right" bgcolor="#f1f1f1">&nbsp;</td>
    <td align="left"><input name="dosubmit" type="submit" id="dosubmit" value="提交" /></td>
  </tr>
</table>
</form>
<table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td align="center" bgcolor="#f1f1f1">字段</td>
    <td align="center" bgcolor="#f1f1f1">类型</td>
    <td align="center" bgcolor="#f1f1f1">注释</td>
    <td align="center" bgcolor="#f1f1f1">默认</td>
  </tr>
  <?php
		foreach($q as $r){
  ?>
  <tr>
    <td align="center"><?php echo $r["Field"]; ?></td>
    <td align="center"><?php echo $r["Type"]; ?>  <?php echo $r["Null"]; ?></td>
    <td align="center"><?php echo $r["Comment"]; ?></td>
    <td align="center"><?php echo $r["Default"]; ?></td>
  </tr>
  <?php
  		}
  ?>
</table>
</body>
</html>
